package main

import (
	"grpc-server.com/interceptor"
	"grpc-server.com/service"
	"net"

	"google.golang.org/grpc"
	"protol.com/ecommerce"
)

func main() {
	//创建一个没有注册service的server
	server := grpc.NewServer(grpc.UnaryInterceptor(interceptor.OrderUnaryServerInterceptor))

	ecommerce.RegisterOrderManagementServer(server, &service.OrderManagementImpl{})

	lis, err := net.Listen("tcp", ":8009")
	if err != nil {
		panic(err)
	}

	if err := server.Serve(lis); err != nil {
		panic(err)
	}
}
